package com.wyw.learning.thread.lock.lock;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * 乐观锁demo
 *
 * @author Mr Wu    yewen.wu.china@gmail.com
 * @date 2021/7/21   10:12 下午
 * <p>
 * Update History:
 * Author        Time            Content
 */
public class PessimismOptimismLock {
    /**
     * 乐观锁
     */
    int a;
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger();
        atomicInteger.incrementAndGet();
    }

    /**
     * 悲观锁
     */
    public synchronized void testMethod(){
        a ++;
    }
}
